package joapp

// -------- bool --------

type IAppFlagBool interface {
	IAppFlag
	GetBool() bool
}

type AppFlagBool struct {
	AppFlagBase
}

func NewAppFlagBool(shortName, longName, usage string) *AppFlagBool {
	af := new(AppFlagBool)
	af.Init(shortName, longName, usage)
	return af
}

func (af *AppFlagBool) GetBool() bool {
	return af.exist
}

// -------- int --------

type IAppFlagInt interface {
	IAppFlag
	GetInt() int
}

type AppFlagInt struct {
	AppFlagBase
	value    int
	defValue int
}

func NewAppFlagInt(shortName, longName, usage string, defVal int) *AppFlagInt {
	af := new(AppFlagInt)

	af.Init(shortName, longName, usage)
	af.defValue = defVal

	return af
}

func (af *AppFlagInt) GetInt() int {
	return af.value
}

// -------- uint --------

type IAppFlagUint interface {
	IAppFlag
	GetUint() uint
}

type AppFlagUint struct {
	AppFlagBase
	value    uint
	defValue uint
}

func NewAppFlagUint(shortName, longName, usage string, defVal uint) *AppFlagUint {
	af := new(AppFlagUint)
	af.Init(shortName, longName, usage)
	af.defValue = defVal
	return af
}

func (af *AppFlagUint) GetUint() uint {
	return af.value
}

// -------- int64 --------

type IAppFlagInt64 interface {
	IAppFlag
	GetInt64() int64
}

type AppFlagInt64 struct {
	AppFlagBase
	value    int64
	defValue int64
}

func NewAppFlagInt64(shortName, longName, usage string, defVal int64) *AppFlagInt64 {
	af := new(AppFlagInt64)
	af.Init(shortName, longName, usage)
	af.defValue = defVal
	return af
}

func (af *AppFlagInt64) GetInt64() int64 {
	return af.value
}

// -------- float64 --------

type IAppFlagFloat64 interface {
	IAppFlag
	GetFloat64() float64
}

type AppFlagFloat64 struct {
	AppFlagBase
	value    float64
	defValue float64
}

func NewAppFlagFloat64(shortName, longName, usage string, defVal float64) *AppFlagFloat64 {
	af := new(AppFlagFloat64)
	af.Init(shortName, longName, usage)
	af.defValue = defVal
	return af
}

func (af *AppFlagFloat64) GetFloat64() float64 {
	return af.value
}

// -------- string --------

type IAppFlagString interface {
	IAppFlag
	GetString() string
}

type AppFlagString struct {
	AppFlagBase
	value    string
	defValue string
}

func NewAppFlagString(shortName, longName, usage string, defVal string) *AppFlagString {
	af := new(AppFlagString)
	af.Init(shortName, longName, usage)
	af.defValue = defVal
	return af
}

func (af *AppFlagString) GetString() string {
	return af.value
}
